{"cells":[{"cell_type":"markdown","metadata":{"id":"68CF11F013FC40039E5A5F72614E1D94","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":[" # <center>Lecture 2: Bayes' Rule  </center>  \n"," \n"," ## <center> Instructor: Dr. Hu Chuan-Peng  </center>"]},{"cell_type":"markdown","metadata":{"id":"54BF1EB7111C4E07B600E98C90C41A67","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["## Part 1: 【和鲸平台】整合教学+练习"]},{"cell_type":"markdown","metadata":{"id":"602990F63F5344979136E69F6892097C","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 和鲸平台"]},{"cell_type":"markdown","metadata":{"id":"348758B92AE34D778507B26A71F56FBA","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["https://www.heywhale.com/mw-org/NNUPsy/workspace/index  \n","\n","进入网址注册后：\n","\n","![Image Name](https://cdn.kesci.com/upload/s0vfx2ld9v.png?imageView2/0/w/1280/h/1280)"]},{"cell_type":"markdown","id":"6236e4c5","metadata":{},"source":["![Image Name](https://cdn.kesci.com/upload/s0vfy0fzn1.png?imageView2/0/w/1280/h/1280)"]},{"cell_type":"markdown","id":"0acbdd2b","metadata":{},"source":["![Image Name](https://cdn.kesci.com/upload/s0vfyo1fhv.png?imageView2/0/w/1280/h/1280)"]},{"cell_type":"markdown","id":"a8b0cfb5","metadata":{},"source":["![Image Name](https://cdn.kesci.com/upload/s0vfzqio5j.png?imageView2/0/w/1280/h/1280)"]},{"cell_type":"markdown","id":"3a85a62b","metadata":{},"source":["更重要的是：任何问题都可以微信群或者平台里发帖提问。 \n","\n","助教和老师会尽快回复的 🚀。\n","\n","![Image Name](https://cdn.kesci.com/upload/s0vhsizi3f.png?imageView2/0/w/640/h/640)\n","\n","![Image Name](https://cdn.kesci.com/upload/s0vhookjac.png?imageView2/0/w/640/h/640)"]},{"cell_type":"markdown","metadata":{"id":"E937437455E84EC0BCB02F0125B93D7E","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":[" ## Part 2: 单一事件的贝叶斯模型"]},{"cell_type":"markdown","metadata":{"id":"8B3509C0DD504D97A5EA32E20E9101D5","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["**“假新闻”**  \n","\n","《柯林斯词典》将“假新闻 (fake news)”列为2017年度词汇。虚假新闻随着在线新闻和社交媒体平台的出现而激增，这些平台允许用户在几乎没有质量控制的情况下发布文章。  \n","\n","因此，**我们需要你来扮演“实施核查员 (fact-checker)”帮助读者将文章标记为“真实”或“虚假”**。  \n","\n","我们将探索贝叶斯哲学如何帮助我们区分不同性质的文章。  \n","\n","- 为此，我们将对发布在Facebook上的150篇文章进行抽样调查  \n","- 这些文章由五名BuzzFeed记者事先进行了事实核查。\n","  - 国外著名的事实核查网站 https://www.snopes.com/; https://www.factcheck.org/.\n","\n","![Image Name](https://cdn.kesci.com/upload/s0vgmzp3o2.png?imageView2/0/w/600/h/600)  \n","\n","> source: 微信小程序，微信辟谣助手，2023.9.12"]},{"cell_type":"markdown","metadata":{"id":"41B8E2658A0B4A489ADC75137BE4F1AD","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["以下代码展示了部分数据，包括新闻的标题 (tiltle)，网址 (url)，作者 (author) 和文章标记 (type)"]},{"cell_type":"code","execution_count":null,"metadata":{"collapsed":false,"hide_input":false,"id":"965B2930F1614CDF94AA0C5FFA62B0B2","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"skip"},"tags":[],"trusted":true},"outputs":[],"source":["# 导入数据加载和处理包：pandas\n","import pandas as pd\n","# 导入数字和向量处理包：numpy\n","import numpy as np\n","# 导入基本绘图工具：matplotlib\n","import matplotlib.pyplot as plt\n","\n","# 使用 pandas 导入示例数据\n","try:\n","  fake_news = pd.read_csv(\"/home/mw/input/bayes20238001/fake_news.csv\")\n","except:\n","  fake_news = pd.read_csv('data/fake_news.csv')\n","fake_news = fake_news[['title', 'url', 'authors', 'type', 'title_has_excl']]"]},{"cell_type":"code","execution_count":3,"metadata":{"collapsed":false,"hide_input":true,"id":"D1079AB8AB8B49779786A032FA268224","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":true,"slideshow":{"slide_type":"subslide"},"tags":[],"trusted":true},"outputs":[{"data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>title</th>\n","      <th>url</th>\n","      <th>authors</th>\n","      <th>type</th>\n","      <th>title_has_excl</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Clinton's Exploited Haiti Earthquake ‘to Steal...</td>\n","      <td>http://freedomdaily.com/former-haitian-senate-...</td>\n","      <td>NaN</td>\n","      <td>fake</td>\n","      <td>False</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>Donald Trump Jr. Just Pinned A Tweet So Stupid...</td>\n","      <td>http://winningdemocrats.com/donald-trump-jr-ju...</td>\n","      <td>NaN</td>\n","      <td>real</td>\n","      <td>False</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>Michelle Obama NOT Leaving The White House – H...</td>\n","      <td>http://rightwingnews.com/top-news/michelle-oba...</td>\n","      <td>Sierra Marlee</td>\n","      <td>fake</td>\n","      <td>True</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>Trump hits Clinton on Islamic State: ‘It is ti...</td>\n","      <td>http://politi.co/2cEsAnL</td>\n","      <td>Jack Shafer,Nolan D</td>\n","      <td>real</td>\n","      <td>False</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>Australia Voted To Ban Muslims And Liberals Ar...</td>\n","      <td>https://goo.gl/p7jFZG</td>\n","      <td>Blair Patterson</td>\n","      <td>fake</td>\n","      <td>False</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["                                               title  \\\n","0  Clinton's Exploited Haiti Earthquake ‘to Steal...   \n","1  Donald Trump Jr. Just Pinned A Tweet So Stupid...   \n","2  Michelle Obama NOT Leaving The White House – H...   \n","3  Trump hits Clinton on Islamic State: ‘It is ti...   \n","4  Australia Voted To Ban Muslims And Liberals Ar...   \n","\n","                                                 url              authors  \\\n","0  http://freedomdaily.com/former-haitian-senate-...                  NaN   \n","1  http://winningdemocrats.com/donald-trump-jr-ju...                  NaN   \n","2  http://rightwingnews.com/top-news/michelle-oba...        Sierra Marlee   \n","3                           http://politi.co/2cEsAnL  Jack Shafer,Nolan D   \n","4                              https://goo.gl/p7jFZG      Blair Patterson   \n","\n","   type  title_has_excl  \n","0  fake           False  \n","1  real           False  \n","2  fake            True  \n","3  real           False  \n","4  fake           False  "]},"execution_count":3,"metadata":{},"output_type":"execute_result"}],"source":["# 仅显示数据的前5行\n","fake_news.head()"]},{"cell_type":"markdown","metadata":{"id":"FA85A994830E4DC7A3F980B24AE60A6B","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 先验 (prior) 和 数据 (data) 的差异  \n","\n","#### 先验  \n","\n","通过查看数据集，我们可以发现这份数据集中，40%的报道是假新闻，60%的报道是事实。  \n","\n","我们可以将其作为一种先验经验，即我们从这个数据中看到的新闻，有40%的为假新闻。  \n","\n","- 需要注意的是，先验可以是主观经验。例如，有的人可能认为50%的新闻为虚假新闻。也有人会根据某些数据而生成自己独特的先验，如本示例中的40%。  \n","- 先验的关键是，在*当前事件*发生之前，对事件发生的事先猜测或推断。例如，我们看见一篇*新发布*的文章，其标题为：“总统有一个有趣的秘密！”。该新闻就是当前事件，其为虚假信息的概率有别于我们对其的事先猜测。"]},{"cell_type":"code","execution_count":4,"metadata":{"collapsed":false,"id":"84F93D064F384BD88492D71BDCC190EA","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"subslide"},"tags":[],"trusted":true},"outputs":[{"data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>数量</th>\n","      <th>百分比</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>real</th>\n","      <td>90</td>\n","      <td>60.0</td>\n","    </tr>\n","    <tr>\n","      <th>fake</th>\n","      <td>60</td>\n","      <td>40.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["      数量   百分比\n","real  90  60.0\n","fake  60  40.0"]},"execution_count":4,"metadata":{},"output_type":"execute_result"}],"source":["# 计算不同水平的数量和百分比\n","level_counts = fake_news['type'].value_counts()\n","level_percentages = fake_news['type'].value_counts(normalize=True) * 100\n","# 创建一个新的 DataFrame 合并结果\n","result_df = pd.DataFrame({'数量': level_counts, '百分比': level_percentages})\n","# 展示结果\n","result_df"]},{"cell_type":"markdown","metadata":{"id":"9AB53C2E14FC46A3AD6FF1B6D2AE5327","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["#### 数据  \n","\n","之前的信息只考虑了事实报道和虚假新闻的比率，只凭借这一简单的比率信息，我们仍然对当前出现新闻的真假而不自知。  \n","\n","一个有趣的现象是，标题使用*惊叹号*的新闻，往往是虚假新闻。例如：“总统有一个有趣的秘密！”。  \n","\n","\n","![Image Name](https://cdn.kesci.com/upload/s0vgueuw94.png?imageView2/0/w/600/h/300) \n","\n","> source: 微信小程序，微信辟谣助手，2023.9.11"]},{"cell_type":"markdown","metadata":{"id":"6C7167A82CFE4CD4885C000F9ECC5E80","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["我们的**数据**也支持这一点，通过查看数据集可发现，26.67%（16/60）的假新闻标题使用感叹号，但只有2.22%（2/90）的真实新闻标题使用惊叹号："]},{"cell_type":"code","execution_count":5,"metadata":{"collapsed":false,"id":"46C41747B9A24F94890DF7634AC23482","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"subslide"},"tags":[],"trusted":true},"outputs":[{"data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th>title_has_excl</th>\n","      <th>False</th>\n","      <th>True</th>\n","    </tr>\n","    <tr>\n","      <th>type</th>\n","      <th></th>\n","      <th></th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>fake</th>\n","      <td>44</td>\n","      <td>16</td>\n","    </tr>\n","    <tr>\n","      <th>real</th>\n","      <td>88</td>\n","      <td>2</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["title_has_excl  False  True\n","type                       \n","fake               44    16\n","real               88     2"]},"execution_count":5,"metadata":{},"output_type":"execute_result"}],"source":["# 计算不同水平的数量\n","result_df = fake_news.groupby(['type', 'title_has_excl']).size().unstack()\n","# 结果\n","result_df"]},{"cell_type":"markdown","metadata":{"id":"D2CCA35ABDB84EDF95CBA437CEA42B31","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["#### 先验 vs 数据  \n","\n","现在，我们获得了两种信息：先验信息(prior)表明大部分的报道是事实(60%)，而惊叹号数据(data)表明使用惊叹号的更可能是假新闻(26.67%)。  \n","\n","我们如何结合两种信息进行推断？ 如何在两种信息间进行权衡？  \n","\n","这就是贝叶斯学派关注的问题。  \n","\n","![Image Name](https://www.bayesrulesbook.com/chapters/figs/chapter_2/fake_news_diagram.png)  \n","\n","\n","$$  \n","Posterior = \\frac {data * \\, prior}{Average \\, probability \\, of \\, data}  \n","$$  \n"]},{"cell_type":"markdown","metadata":{"id":"A3AC420F0AA64D2984436F8A4866605B","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["#### 先验概率模型(Prior probability model)  \n","\n","首先，我们将一篇文章真实性的概率进行形式化  \n","\n","$$  \n","P(B) = 0.40 \\\\  \n","\n","P(B^{c}) = 0.60  \n","$$  \n","\n","$B$表示一篇报道为假新闻的概率，$B^{c}$则表示一篇报道非假新闻的概率($B^{c}:B$ complement)"]},{"cell_type":"markdown","metadata":{"id":"C5D28EA86535492184C63B7EF69300F5","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["\n","\n","| 事件\t    |$B$         |$B^{c}$ |Total|  \n","|---------- |------------|--------|-----|  \n","|probability|0.4         |0.6     |1    |  \n","\n","\n","\n","**$P(B)$** 和 **$P(B^{c})$** 构成了新闻真实性概率的先验模型(prior model)  \n","\n","作为一个有效的概率模型(valid probability model)，它必须：  \n","\n","（1）考虑所有可能的事件（所有文章都必须是假的或真的，没有其他可能性）；  \n","\n","（2）它为每个事件分配先验概率；  \n","\n","（3）这些概率加起来为1。"]},{"cell_type":"markdown","metadata":{"id":"3D6004D329194B2482D300C0BA838D12","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 条件概率&似然  \n","\n","**形式化数据结果**  \n","\n","在第二步中，我们将对数据结果(data)进行形式化。  \n","\n","我们从标题带有感叹号新闻的数据中得知，  \n","\n","- 如果一篇报道是假新闻，其标题出现感叹号的概率是26.67%；  \n","- 如果一篇报道为事实，其标题出现感叹号的概率是2.22%。  \n","\n","所以感叹号的出现依赖于报道的性质，或者可以说以报道的性质为前提条件。  \n","\n","我们可以用条件概率的形式来表示感叹号出现的可能性。  \n","$$  \n","P(A|B) = 0.2667  \n","$$  \n","$$  \n","P(A|B^{c}) = 0.0222  \n","$$"]},{"cell_type":"markdown","metadata":{"id":"BC3413ADFA984D1E8EF36384E05D0DCF","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["#### 条件概率  \n","\n","条件概率表示为$P(A|B)$，表示“A在B发生的条件下发生的概率”  \n","\n","在贝叶斯统计中，条件概率是一个非常关键的概念。$P(A|B)$与$P(A)$的对比，表示事件B的发生如何影响我们对事件A的认知  \n","\n","1. 在一些时候，事件B发生可能使得事件A发生的可能性增加，例如，每天练习单簧管的人加入管弦乐队的概率高于一般人群，即：  \n","$$  \n","P(加入管弦乐队|练习) > P(加入管弦乐队)  \n","$$  \n","\n","2. 而有些时候，事件B的发生则可能使得事件A发生的可能性降低，例如，如果你每天洗手，那么你得流感的几率可能小于一般人群，即：  \n","$$  \n","P(得流感|洗手) < P(得流感)  \n","$$  \n","\n","3. 并且注意$P(A|B) \\neq P(B|A)$ \\  \n","比如，所有的小狗都是可爱的，但可爱的却不一定全是小狗  \n","$$  \n","P(可爱的|小狗) = 1  \n","$$  \n","\n","$$  \n","P(小狗|可爱的) < 1  \n","$$  \n","\n","4. 当A与B相互独立时，B的发生则不会影响我们对A事件的认知  \n","$$  \n","P(A|B) = P(A)  \n","$$"]},{"cell_type":"markdown","metadata":{"id":"AFD44C609BB54C8FA66BC7600B2EADFD","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["#### 似然(likelihood)  \n","\n","**似然的定义**  \n","\n","回到感叹号新闻标题的例子，我们所获得的数据(data)只是告诉我们这篇文章的标题出现了感叹号，而根据条件概率的信息可知，$P(A|B) = 0.2667，P(A|B^{c}) = 0.0222$，标题含有感叹号的文章更可能(more likely)是假新闻。  \n","\n","也就是说，我们知道当前的数据更可能在某一种假设下出现。在这个例子中，我们比较不同假设下当前数据出现的可能性  \n","$P(A|B) = 0.2667 > P(A|B^{c}) = 0.0222$ 来确定当前数据在不同假设下发生的相对可能性  \n","\n","--------------------------------------------------------------------  \n","\n","这就是似然函数(likelihood function)的含义，它表明了数据A在各种假设下出现的概率，它是一系列条件概率的组合  \n","\n","如针对“数据A:新闻标题含有感叹号” 的似然函数可以写成：$L(·|A)$  \n","$$  \n","L(B|A) = P(A|B) \\quad\\quad L(B^{c}|A) = P(A|B^{c})  \n","$$  \n","这表明了标题含有感叹号在“假新闻”与“事实报道”这两种假设下出现的概率  \n","\n","*注意，在似然函数中，数据是已知发生的，而假设是可能发生的  \n"]},{"cell_type":"markdown","metadata":{"id":"86F782A3322D49E4839AA89683B4D365","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 概率(Probability) vs 似然(likelihood)  \n","\n","当假设$B$是已知的，条件概率函数$P(·|B)$允许我们比较在假设$B$发生的前提下，各种可能事件$A$或$A^{c}$发生的概率。  \n","\n","当事件$A$已经发生，似然函数$L(·|A)= P(A|·)$允许我们比较在各种假设$B$或$B^{c}$下，事件$A$发生的概率。  \n","\n","-----------------------------------------------------------  \n","\n","下表对以上的信息做了一个总结，注意：  \n","* 先验概率的总和等于1  \n","* 似然总和不等于1  \n","似然函数并不是概率函数(likelihood function is not a probability function),因为它告诉我们事件A在不同假设下发生的相对可能性，在这里$L(B|A) > L(B^{c}|A)$  "]},{"cell_type":"markdown","metadata":{"id":"AF3E2F823AC045CC87E7AD7275928058","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["TABLE 2.2: Prior probabilities and likelihoods of fake news.  \n","\n","| event   |   B       | $B^c$  | Total   |  \n","| -------- | -------- | --------  | -------- |  \n","| prior.   | 0.4      | 0.6      | 1          |  \n","| likelihood | 0.2667 | 0.0222 | 0.2889 |"]},{"cell_type":"markdown","metadata":{"id":"0286448BE5A64F7EA0F1519FBF1C0683","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 分母（normalizing constant）-- **边际概率 (marginal probability)**  \n","\n","似然函数有效总结了在真假新闻中的感叹号使用，但我们仍然需要得知，在所有新闻标题中使用感叹号的概率如何, 这被称为边际概率 $P(A)$  \n","\n","\n","$$  \n","Posterior \\sim P(B|A) = \\frac {data * prior}{Average probability of data} = \\frac{P(A\\cap B)}{P(A)} = \\frac{L(B|A) * P(B)}{P(A)}  \n","$$  \n"," \n","所有新闻标题中使用惊叹号的概率可被分为两部分：  \n","\n","1. 假新闻的标题出现感叹号，即$P(A\\cap B)$  \n","2. 事实报道的标题出现感叹号$P(A\\cap B^{c})$  \n","\n","两者之和即为边际概率。  \n","$$  \n"," P(A) = P(A \\cap B) + P(A \\cap B^{c}) = L(B|A) * P(B) + L(B^{c} | A) * P(B^{c})  \n","$$\n","\n","$$ P(A) = 0.2667 * 0.4 + 0.0222 * 0.6 = 0.12  $$  \n"]},{"cell_type":"markdown","metadata":{"id":"44941FF9D45248CB9F3BABE34D7A3704","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 后验概率模型(Posterior probability model via Bayes’ Rule)"]},{"cell_type":"markdown","metadata":{"id":"B6ACDDA794E841F2A33C42BEB04898D5","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["**直觉理解**  \n","\n","现在，我们来尝试计算后验概率，比如计算标题使用感叹号的文章是假新闻的概率$P(B|A)$。  \n","\n","在正式计算之前，我们可以回顾一下这个表格来建立一些直觉。  \n","\n","\n","||$B$|$B^c$|Total|  \n","|---|---|---|---|  \n","|$A$|0.1067|0.0133|0.12|  \n","|$A^c$|0.2933|0.5867|0.88|  \n","|Total|0.4|0.6|1|  \n","\n"," \n","\n","因为这篇文章标题使用了感叹号，所以我们直接锁定A行，  \n","- 在A行中，88.9%(0.1067/0.12)的文章为假新闻，11.1%(0.0133/0.12)的文章为事实。  \n","- 因此有88.9%的后验概率认为当前这一文章属于假新闻。  \n"]},{"cell_type":"markdown","metadata":{"id":"067BD0D1E2C64617AD8D7DFECEC38ADB","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["**正式计算**  \n","\n","如何凭借贝叶斯公式的数学形式推导得到该结果？  \n","\n","$$  \n","Posterior \\sim P(B|A) = \\frac {data * prior}{Average \\, probability \\, of \\, data} ={\\frac{P(A\\cap B)}{P(A)}}={\\frac{L(B|A) * P(B)}{L(B|A) * P(B) + L(B^{c}|A) * P(B^{c})}}  \n","$$  \n","\n","- $P(B|A)={\\frac{P(B)L(B|A)}{P(A)}}={\\frac{0.4\\cdot0.2667}{0.12}}=0.889$  \n","- 当带入之前计算得到的数值到贝叶斯公式中，我们得到了标题带有惊叹号的新闻为虚假新闻的概率。  \n","\n","使用同样的方法，我们可以计算出不标题带有惊叹号的新闻为虚假新闻的概率，结果如下表。  \n","- 可以注意到：先验概率和后验概率的和均等于1。  \n","\n","TABLE 2.4: The prior and posterior models of fake news.  \n","\n","\n","| event    | $B$     | $B^c$ | Total    |  \n","| --------  | -------- | -------- | -------- |  \n","| prior probability | 0.4 | 0.6 | 1 |  \n","| posterior probability | 0.889 | 0.111 | 1 |  \n"]},{"cell_type":"markdown","metadata":{"id":"A7FB8E608A0E420FA2A9669374EC76E1","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["思考时间🧐：是否加入分母进行计算，在哪种情况下后验概率之和不为1？"]},{"cell_type":"markdown","metadata":{"id":"743FF37E4D4F4D288A301987986D4F98","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 后验模拟(Posterior simulation)  \n","\n","如何使用代码实现后验概率的计算？\n"]},{"cell_type":"markdown","id":"c1ec69b1","metadata":{"slideshow":{"slide_type":"subslide"}},"source":["👀 如果对以下代码不太熟悉，可以先学习 2. python数据操作基础教程 \n","![Image Name](https://cdn.kesci.com/upload/s0vfx2ld9v.png?imageView2/0/w/1280/h/1280)"]},{"cell_type":"markdown","metadata":{"id":"79770A093B574AE89BF26CD1EC1F5531","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["1. 定义文章类型与相应的先验概率"]},{"cell_type":"code","execution_count":6,"metadata":{"collapsed":false,"id":"70A4ADE3CD6049209F1E8E491E15CC61","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[],"source":["# 定义文章类型\n","article = pd.DataFrame({'type': ['real', 'fake']})\n","\n","# 定义先验概率\n","prior = [0.6, 0.4]"]},{"cell_type":"markdown","metadata":{"id":"C2FF510FD6C5456BA9ACD5FD4A0B2C0E","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["2. 模拟一些可能被投放给你的文章"]},{"cell_type":"code","execution_count":7,"metadata":{"collapsed":false,"id":"D5795093D5F143FC94DBB4109E1637CA","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[{"data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>type</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>real</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>fake</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>fake</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>fake</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>fake</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>real</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>fake</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>fake</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>fake</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>real</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["   type\n","0  real\n","1  fake\n","1  fake\n","1  fake\n","1  fake\n","0  real\n","1  fake\n","1  fake\n","1  fake\n","0  real"]},"execution_count":7,"metadata":{},"output_type":"execute_result"}],"source":["# 模拟生成 10000 文章，包括其类型\n","np.random.seed(84735)\n","article_sim = article.sample(n=10000, weights=prior, replace=True)\n","# 查看前 10 行数据\n","article_sim.head(10)"]},{"cell_type":"code","execution_count":8,"metadata":{"collapsed":false,"id":"AFE614E7228741109AC49D6912CE27B6","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[{"data":{"text/html":["<img src=\"https://cdn.kesci.com/upload/rt/AFE614E7228741109AC49D6912CE27B6/s0va4vf66d.png\">"],"text/plain":["<Figure size 432x288 with 1 Axes>"]},"metadata":{"needs_background":"light"},"output_type":"display_data"}],"source":["#我们可以通过画图来查看这些被投放的文章中，事实报道和假新闻的比例。\n","article_sim['type'].value_counts().plot.bar()\n","plt.xticks(rotation=0)\n","plt.show()"]},{"cell_type":"markdown","metadata":{"id":"2FD2DDA330344DD7A826E4EC1BECD751","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["3. 接下来我们需要模拟10000篇新闻标题的感叹号使用情况，  \n","- 和之前相同，假新闻使用感叹号的可能性为26.67% ，  \n","- 事实报道使用感叹号的可能性为2.22% "]},{"cell_type":"code","execution_count":11,"metadata":{"collapsed":false,"id":"DA2AA798CA184A7894C3BDBA4BD2F529","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[],"source":["article_sim['data_model'] = np.where(article_sim['type'] == 'fake', 0.2667, 0.0222)\n","\n","# 定义新闻标题是否使用惊叹号\n","data = ['yes', 'no']\n","\n","# 设置随机种子，以便得到重复的结果\n","rng=np.random.default_rng(84735)\n","# 生成惊叹号相关的数据\n","article_sim['usage'] = article_sim.apply(lambda x: rng.choice(data, 1, p = [x.data_model, 1-x.data_model])[0], axis=1)"]},{"cell_type":"code","execution_count":12,"metadata":{"collapsed":false,"id":"30ADD3ACD99343ED9E26C5B543D69756","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[{"data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th>type</th>\n","      <th>fake</th>\n","      <th>real</th>\n","    </tr>\n","    <tr>\n","      <th>usage</th>\n","      <th></th>\n","      <th></th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>no</th>\n","      <td>2899</td>\n","      <td>5937</td>\n","    </tr>\n","    <tr>\n","      <th>yes</th>\n","      <td>1039</td>\n","      <td>125</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["type   fake  real\n","usage            \n","no     2899  5937\n","yes    1039   125"]},"execution_count":12,"metadata":{},"output_type":"execute_result"}],"source":["# 显示每个类别新闻数量\n","(\n","  article_sim.groupby(['usage', 'type'])\n","    .size()\n","    .unstack(fill_value=0)\n",")"]},{"cell_type":"markdown","metadata":{"id":"91D670B23DB34FD5BE21149F34A98161","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["4. 计算后验值  \n","\n","还记得我们的先验概率为：  \n","- 真实报道 $P(B^c)=0.6$,  \n","- 虚假新闻 $P(B)=0.4$  \n","\n","由以上结果可计算似然：  \n","- 2%的真实报道使用了感叹号(125/(125+5937)), $P(A|B^c)=0.02$;  \n","- 大约26%(1039/(1039+2899))的假新闻标题使用了感叹号, $P(A|B)=0.26$  \n","\n","结合先验和似然，我们可以进一步计算分母(边际概率)：  \n","- $L(B|A)*P(B) + L(B^{c}|A)*P(B^{c}) = 0.26*0.4 + 0.02*0.6 = 0.116$  \n","\n","最后，我们可以计算的到后验 (带有感叹标题的新闻中，虚假新闻的概率)：  \n","- $P(B|A) ={\\frac{L(B|A)*P(B)}{P(A)}}= (0.26*0.4)/0.116 = 89\\%$  \n","- 在10000篇新闻中，标题使用感叹号新闻有1164篇(分母)  \n","- 而现在，我们可以知道，在使用感叹号标题的文章中，89%(1039/1164)的文章为假新闻"]},{"cell_type":"code","execution_count":13,"metadata":{"collapsed":false,"id":"5C36EF3BCDE44EFB982E91DB169C60B0","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":["标题使用感叹号的新闻 1164\n"]},{"data":{"text/plain":["fake    1039\n","real     125\n","Name: type, dtype: int64"]},"execution_count":13,"metadata":{},"output_type":"execute_result"}],"source":["usage_yes = article_sim[article_sim['usage'] == 'yes']\n","print('标题使用感叹号的新闻', usage_yes['type'].value_counts().sum())\n","usage_yes['type'].value_counts()"]},{"cell_type":"markdown","metadata":{"id":"41A8F11719B54C8391CAE6C2BA465982","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["同样地，通过画图来可视化真假新闻中感叹号的使用情况"]},{"cell_type":"code","execution_count":14,"metadata":{"collapsed":false,"id":"3004050B7EBE4335B554FF5500CFFE99","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[{"data":{"text/html":["<img src=\"https://cdn.kesci.com/upload/rt/3004050B7EBE4335B554FF5500CFFE99/s0va9n5300.png\">"],"text/plain":["<Figure size 720x360 with 2 Axes>"]},"metadata":{"needs_background":"light"},"output_type":"display_data"}],"source":["# 定义两幅图的坐标\n","fig, axes = plt.subplots(1, 2, figsize=(10, 5))\n","\n","# 绘制两幅图\n","for i, u in enumerate(article_sim['usage'].unique()):\n","    ax = axes[i]\n","    data = article_sim[article_sim['usage'] == u]\n","    ax.bar(data['type'].unique(), data['type'].value_counts())\n","    ax.set_title(f'usage = {u}')\n","    ax.set_ylim(0, 10000) \n","\n","# 显示   \n","fig.tight_layout()\n","plt.show()"]},{"cell_type":"markdown","id":"a5e75290","metadata":{},"source":["### 总结 (Recap)\n","\n","回到之前的问题：如何判断新闻的真实性？\n","- 哪些信念可以作为先验概率？\n","- 信息的哪些属性可以作为数据？\n","- 如何结合先验和数据更新信念 (贝叶斯公式)。\n","- 如何通过 python 实现以上的计算？"]},{"cell_type":"markdown","id":"9e8d4d52","metadata":{},"source":["### Review"]},{"cell_type":"markdown","id":"57247442","metadata":{},"source":["\n","![Image Name](https://cdn.kesci.com/upload/s14m7y5df0.png?imageView2/0/w/960/h/960)\n","\n","![Image Name](https://cdn.kesci.com/upload/s14m8e4di1.png?imageView2/0/w/960/h/960)"]},{"cell_type":"markdown","metadata":{"id":"AF5772F9A36C4389BB9C924FA3BED0DF","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["## Part3 随机变量的贝叶斯模型"]},{"cell_type":"markdown","metadata":{"id":"161E4DA107B0459A8B5C8F0F99E887D1","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["**随机变量 (random variables)**  \n","\n","在上面的分析中，我们针对“新闻类型”这种随机事件进行分析。接下来我们会针对更加抽象和一般性的**随机变量**进行贝叶斯分析\n","\n","在这部分中，我们关注一个棋手对战机器的例子。  \n","\n","1996年，国际象棋冠军Kasparov和IBM的超级电脑“深蓝”进行了对决。这次对决共有6场比赛，Kasparov的战绩为赢了三局，平局两局，输了一局。到了1997年，二者再次进行对决。  \n","\n","首先我们来了解一个概念，胜率\n","\n","* 想象你玩斗地主，有五局三胜，七局四胜这一说，一轮玩下来，就会出现胜率。\n","* 这个胜率是会变化的，今天赢得多明天输得多\n","* 在每一轮开始前，你并不知道你这次的胜率是多少\n","\n","象棋也是这样，假设Kasparov在任何比赛中的胜率为$\\pi$，$\\pi$是**未知的且会随着时间波动**，所以$\\pi$是一个随机变量。  \n","\n","![Image Name](https://cdn.kesci.com/upload/s0rx4qqsv1.jpg?imageView2/0/w/640/h/640)  \n","> source: Five computers that changed the world https://www.crn.com.au/tools/print.aspx?ciid=323641"]},{"cell_type":"code","execution_count":null,"id":"9e82d5d2","metadata":{},"outputs":[],"source":["# 导入数据加载和处理包：pandas\n","import pandas as pd\n","# 导入数字和向量处理包：numpy\n","import numpy as np\n","# 导入基本绘图工具：matplotlib\n","import matplotlib.pyplot as plt\n","# 导入高级绘图工具 seaborn 为 sns\n","import seaborn as sns\n","# 导入统计建模工具包 scipy.stats 为 st\n","import scipy.stats as st \n","\n","# 设置 matplotlib 样式为 apa\n","import matplotlib.style as mplstyle\n","mplstyle.use('../input/apa.mplstyle')"]},{"cell_type":"markdown","id":"8f920343","metadata":{},"source":["**特定胜率下的获胜结果**\n","\n","现在到了1997年，Kasparov要进行6场对决\n","\n","根据 Kasparov 在 1996 年的战绩，我们进行猜测，他的胜率为 $\\pi = 50\\%$ (六局三胜)。\n","\n","但比赛还没开始，每一种获胜结果都是有可能的。\n","\n","他接下来可能获胜的次数Y可能是0，可能是1，也可能是6，我么知道有7种可能的获胜次数，Y \\in \\{0,1,2,3,4,5,6\\}，那么每一种结果的可能性分别是多少呢？  "]},{"cell_type":"markdown","id":"1e2d24eb","metadata":{},"source":["**二项模型公式**  \n","\n","Kasparov的胜率为$\\pi$，$在\\pi$下某获胜次数发生的概率可表示为：\n","\n","$$  \n","f(y|\\pi) = \\binom{n}{y} \\pi^{y}(1-\\pi)^{n-y} \\quad\\quad for\\;y \\in \\{0,1,2,...,n\\}  \n","$$  \n","$$  \n","\\binom{n}{y} = \\frac{n!}{y!(n-y)!}  \n","$$  \n","\n","$\\pi$ 表示成功的可能性，$y$表示在$n$个试次中成功的次数，二项模型含有的前提假设是：  \n","\n","(1) 所有试次发生都是相互独立的  \n","\n","(2) 在每个试次中，成功的概率都是一个固定的值$\\pi$\n","\n","比如，获胜次数为0~6 的可能性可以分别写成：\n","\n","$$\n","f(Y=0|\\pi=0.5) = \\binom{6}{0} 0.5^0 (1-0.5)^{6}\n","$$\n","$$\n","f(Y=1|\\pi=0.5) = \\binom{6}{1} 0.5^1 (1-0.5)^{5}\n","$$\n","$$\n","...\n","$$\n","$$\n","f(Y=5|\\pi=0.5) = \\binom{6}{5} 0.5^{5} (1-0.5)^{1}\n","$$\n","$$\n","f(Y=6|\\pi=0.5) = \\binom{6}{6} 0.5^{6} (1-0.5)^{0}\n","$$\n","\n","---------------------------------\n","\n","我们可以使用代码帮助计算\n"," `st.binom.pmf(y, n, p)`。其中 p 对应公式中的 $\\pi$。"]},{"cell_type":"code","execution_count":7,"id":"8c1752b6","metadata":{},"outputs":[{"data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>获胜次数</th>\n","      <th>概率</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>0</td>\n","      <td>0.015625</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>1</td>\n","      <td>0.093750</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>2</td>\n","      <td>0.234375</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>3</td>\n","      <td>0.312500</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>4</td>\n","      <td>0.234375</td>\n","    </tr>\n","    <tr>\n","      <th>5</th>\n","      <td>5</td>\n","      <td>0.093750</td>\n","    </tr>\n","    <tr>\n","      <th>6</th>\n","      <td>6</td>\n","      <td>0.015625</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["   获胜次数        概率\n","0     0  0.015625\n","1     1  0.093750\n","2     2  0.234375\n","3     3  0.312500\n","4     4  0.234375\n","5     5  0.093750\n","6     6  0.015625"]},"execution_count":7,"metadata":{},"output_type":"execute_result"}],"source":["y = [0,1,2,3,4,5,6]  # 获胜次数 \n","n = 6                # 比赛总次数\n","p = 0.5              # 假设的获胜概率\n","\n","# 计算概率值\n","prob = st.binom.pmf(y, n, p)\n","\n","result_table = pd.DataFrame({\"获胜次数\":y, \"概率\":prob})\n","result_table"]},{"cell_type":"code","execution_count":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A0f4f4PO8pFVLGWUAAAAASUVORK5CYII=","text/plain":["<Figure size 640x480 with 1 Axes>"]},"metadata":{},"output_type":"display_data"}],"source":["# 绘制灰色竖线\n","for i, j in zip(y , prob):\n","    plt.plot([i, i], [j, 0], 'gray', linestyle='-', linewidth=1, zorder=1, )\n","\n","# 绘制黑色点(各胜率次数的胜率)\n","plt.scatter(y, prob, c='black')\n","\n","plt.ylabel('$f(y|\\pi)$')\n","plt.xlabel('y')\n","\n","plt.xlim(-0.2,6.2)\n","plt.ylim(0,0.5)\n","plt.show()"]},{"cell_type":"markdown","id":"9fcaac4b","metadata":{},"source":["*显然，当 Kasparov 获胜概率为 0.5 时，他在六场比赛中获得 y=3 场胜利的概率最高(p = 0.216)。*"]},{"cell_type":"markdown","id":"57407f70","metadata":{},"source":["\n","**概率质量密度函数(probability mass function, pmf)：** 用来描述离散型随机变量在各特定取值上的概率  \n","\n","在上图中我们看到，获胜次数y在不同的取值上的概率不同。\n","\n","* 由于$y$的个数是有限的，并且是随机发生的，我们把$y$称为离散型随机变量，而$y$发生的概率$f(y)$则被称为概率密度函数\n","\n","\n","对于离散型随机变量$Y$，$Y$各取值的概率由$f(y)$指定：  \n","$$  \n","f(y) = P(Y=y)  \n","$$  \n","\n","并且有如下性质：  \n","\n","* 对所有y的取值来说，$0\\leq f(y) \\leq 1$  \n","* $\\sum_{all\\,\\pmb{y}}f(y) = 1$，y取值的所有概率之和为1"]},{"cell_type":"code","execution_count":10,"id":"21a5e584","metadata":{},"outputs":[{"data":{"text/plain":["0.9999999999999999"]},"execution_count":10,"metadata":{},"output_type":"execute_result"}],"source":["sum(result_table['概率'])"]},{"cell_type":"markdown","id":"5b174c3c","metadata":{},"source":["### 二项似然函数(The Binomial likelihood function)"]},{"cell_type":"markdown","id":"22cb2c91","metadata":{},"source":["**不同的信念**\n","\n","然而，并不是所有人都只根据1996年的成绩，认为Kasparov的胜率为0.5。\n","\n","比如：\n","\n","- Kasparov 的支持者认为，Kasparov 的获胜概率为 0.8。\n","- “深蓝” 的支持者认为，Kasparov 的获胜概率仅为 0.2。  \n","\n","Kasparov的获胜概率高，那六场比赛里他赢的次数多，反之，获胜概率低，那六场比赛里他输的次数多。\n","\n","这样看来，“Kasparov的支持者” 和 “深蓝支持者” 对于 Kasparov在6场比赛中的获胜次数有着不同的设想。\n","\n","我们可以计算两种支持者心中获胜次数的概率分布并画图。"]},{"cell_type":"code","execution_count":1,"id":"18527be9","metadata":{},"outputs":[{"ename":"SyntaxError","evalue":"invalid syntax (54530700.py, line 1)","output_type":"error","traceback":["\u001b[1;36m  Cell \u001b[1;32mIn[1], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m    **不同的信念**\u001b[0m\n\u001b[1;37m    ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"]}],"source":["y = [0,1,2,3,4,5,6]  # 获胜次数 \n","n = 6                # 比赛总次数\n","\n","# 计算似然值\n","p = 0.5              # 根据以往战绩假设的获胜概率\n","likelihood1 = st.binom.pmf(y, n, p)\n","p = 0.8              # Kasparov支持者眼中的获胜概率\n","likelihood2 = st.binom.pmf(y, n, p)\n","p = 0.2              # 深蓝支持者眼中的获胜概率\n","likelihood3 = st.binom.pmf(y, n, p)\n","\n","result_table = pd.DataFrame({\n","  \"获胜次数\":y, \n","  \"可能性\":likelihood1, \n","  \"Kasparov支持者\":likelihood2, \n","  \"深蓝支持者\":likelihood3})\n","result_table"]},{"cell_type":"code","execution_count":89,"id":"fb40d391","metadata":{},"outputs":[{"data":{"image/png":"iVBORw0KGgoAAAANSUhEUgAAA9wAAAGRCAYAAACXCbuGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAABQDklEQVR4nO3de3gU9b3H8c/mQkiy2WASMYEN9wAmhLYYFNumAlo9yCGpIVC5lItaac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3saNN954xdfXr9NXX331im1fffVV5/p/7bXXWtVvfM1dwf36668bERERzvEvvPCCbztpEnKz7dWv87bI0+b8fQMxVx9//HFDklFaWuoyftKkSYYk4+TJk85xwZCrl2bciBEjjJKSEqOwsND42c9+ZnTo0ME5LTs729dd9Yi75dq2bZtxxx13OMd3797d2Z6Cu30gA6+sNRn4zjvvGLW1tS7j9u7da0RERBgTJkxo0L41Gcgp5X7m0v+reeONN/Too4+qa9euioyM1Pe+9z3t3LnTbdstW7Zozpw5SkpKUseOHXXkyBFnu8rKSs2ePVspKSmKiIjQVVddpZEjR7qcpvvAAw8457VhwwaXPj3xxBPOaStWrGjw3pf+/8/x48f1wAMPqHfv3oqIiFCnTp00dOhQvfrqqw2WdejQoc55HDp0yDn+0lOj1qxZ4xx/4sQJ/eQnP1H37t3VoUMHxcTEqG/fvho3bpzeeuutZq/XxtbVX/7yF40ZM0YpKSnq1KmTOnTooC5dumjs2LHatWuXS7+HDRvmfP4///M/DU7D9cb6aczhw4ed28Gtt97qMu2+++5r9LRsd+vam/Lz8xUaGqp7773XOa5jx466++679e6776q8vLzZ8zp9+rTOnz/f6PRbbrnF+fjy7RXe8/bbb+sHP/iBamtrJUn/+Z//qXvuucc5vbn7TL3m7MOeZGBL+tCcLGjOfuppZjamubnmaV629FjSnHXe3HXUnHXep0+fK+ap1Lzj2JXe69Lj4uWaylXJd9na2lytrq6WJF1zzTUu45OSkhQSEqIOHTo4xwVbrnbu3Fnf/e53lZWVpWeeeUZ/+MMfnNMKCwu1fft25/Pmbn+etm/Jvtfc5br55pu1ePFi5/jjx49f8bWe5owny9oYMpAMbEprMvDb3/62S8ZJUkpKitLS0vTpp582aN+qDPSoPIfPXfqtY79+/RqcEmSz2Yy///3vDdr26tXLpd3BgwcNwzCMf/zjH4bdbnd7elF4eLhRWFhoGIZhvPfee87x48ePd+nTt771LWf7L774osF71387euDAASMxMbHR05l+/vOfu8z3pptuatBfw3D9pnb16tXO8cOHD2903o888kiz12tj62rp0qWNzj8qKsr45JNPGvT78qH+m0lvrJ/GrF271vmal156yWXatm3bjOuvv95ITEx0OSW7V69eRmpqqttTgc+ePWtUVlY2a6irq2u0X7fccotx7bXXNhi/bds2Q5KxadOmJper/hteq9VqSDJCQ0ONoUOHGh9++KHb9vV/x379+jU5XzTfpfve4MGDjdjYWOfzRYsWNWjf3H2mXnP2YU8ysCV9uFIWNHc/9TQzG9PcXPM0L1t6LGnOOvc0y5pa5927d79injb3ONacv29jmspVw/BdtrY2V7ds2WJIF08f/+ijj4zDhw8b//u//2vYbDZj5syZDdoHeq429m8z9W655Rbn9LvvvtswDM+2P0/be7rvebJctbW1xpIlS5zjr7vuOrfve+kv3J7mjKfrxh0ykAw0MwMvd+HCBaNr167Grbfe6nZ6SzOQgtvPXLqjREVFGcuXLzc2btxoZGRkOMfn5OQ0aCtd/N/XrVu3GitXrnR+yBs5cqRz+qRJk4ytW7ca//Vf/+UsauLj4w2Hw2EYhmH06dPHGSxnzpwxDMMw9u/f73z9qFGj3PazPqz/7d/+zTlu6NChxqZNm4ynn37a6Nixo3P8e++955yHJ+FZXV1tWCwWQ5LxrW99y9i0aZOxZcsW4/nnnzdGjx5tPPHEE81er42tq+3btxu//e1vjU2bNhlvvvmm8cYbbxi//vWvna/58Y9/bBiGYezatct45plnnOPrT98qKSkx9u7d67X105hHH33U2f7dd99tMP2b3/ymMWLECJdxnTp1Mu69916387v0VKYrDU2FdVpamjF8+PAG4/fs2WNIMp5//vkml+udd94xRo8ebfzud78zCgsLjaVLlxrx8fFGx44djZ07dzZof+uttxqSDIvFYpw/f77JeaN5Gvs/wAcffNBt++buM4bR/H3Ykwz0tA+Xz99dFniyn3qSme54kmut+bDpybGkOevc0yxrap0XFxdfMU89OY41J+vduVKuGoZvsrW1uWoYhrF48WIjMjLS5f0a+5I60HP1SgX3pdtBfYHqyfbnaXtP973mLJe74eqrrzbeeecdZ3tvFdyerpvLkYFkYFtk4KVeeuklQ5Lxu9/9zu30lmZgmOC3Zs2apQceeECSl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pa3v22EhYUZb731lrNN/VUrFyxY4PLaYcOGGbfffruxZMkSY9WqVcbMmTONqKgoIzY2tsGtnV599VXneisqKjJ9uYJFY1fwPXr0qNG7d2/ntJSUFOP48eMe7TOG0bx92JMMNAzP9tvL5+8uC1qynzYnMxvT3FzzNC9beixpzjr3dB1daZ1fKU89OY41J+sb01iuGoZvs7U5uWoY7rP1rbfeMkJDQ43OnTsbixYtMp577jnn9nrPPfe4vD4YcvVKV/OWZIwcOdKorq52vsbTz1Et3V6bs++1ZrkGDRpknD17tsH7XrqfeJozLfmMeTkykAy8kpZm4IwZMwzp4h1DLr2VWf1wudZkIAW3n7l0R3njjTeMxx57zOjatasRERFhfPe733W5J3Fzd6rKykrjwQcfNPr372907NjRiImJMfr3729MmjTJ2LRpU4PL3ufl5bnsxO5uydTYex89etS4//77jZ49exrh4eGGzWYzvve97xnr169327d169YZffr0MTp06GAMGDDAeOWVVxq9xcOvf/1r47bbbjPsdrsRERFhREREGP369TMefPBBl4PjldZrY+vq5MmTxuTJk42EhASjU6dOxo9+9CPj5MmTztdd/sH9gw8+ML773e8aMTExDfrrrfXTmGeffdY5//rbRtTW1hphYWHGww8/7NL27rvvNiIiIpp1a5HWqqmpMebOnWskJiYaERERxuDBg42tW7e6tGms4F6+fLlx/fXXG3FxcUZYWJiRlJRkTJw40SgrK2vwPuPGjTMkGYmJiQF56xpfaeqWOQcPHjS6du3q8qHE032mOfuwJxloGJ7vt83JAk/30+ZkZmM8yTVP8rKlx5LmrHNP11Fz1nlTeWoYzT+OtebDprtcNQzfZ2tzctUwGs/W999/3xgxYoSRmJhohIeHG3379jUef/xx49y5cy7tgiFXLy9MQ0JCjJiYGKNv377GmDFjjNdee824cOFCg9d5+jmqJdtrc/e95ixX/RAZGWkMGDDAeOSRR4yqqipn+6b2E09ypiXr5nJk4EVkYONamoGX3krO3XC51mQgBbefac2OguBx+vRpIyEhwZBkPPTQQ77uTpv64osvnPeU/fWvf+3r7sDLyEDv8GQ9ss4vIlfJ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rdvn0pLS12GzZs3U3ADAAAAAIJOqwru5557zvk4JCREffv2Vd++fZWTk+Mcf+7cuda8BQAAAAAAfqnVF027kvDwcLPfAgAAAACAdsejX7i9dWr4L3/5S6/MBwAAAACA9sqjgnv16tWtfkOLxULBDQAAAAAIeB4V3AcPHjSrHwAAAAAABBTT/4cbAAAAAIBg1KqC+6abbtJ7773nrb4AAAAAABAwWlVwnz59Wt/5znd0xx136NNPP/VWnwAAAAAA8HutKrh37typl19+WaWlpRo4cKDuuusulZeXe6tvAAAAAAD4rVb/D/e4ceP06aefatmyZdqyZYv69u2rOXPm6MSJE97oHwAAAAAAfskrF00LCwvT9OnTtX//fj388MP63e9+p969e2vJkiX66quvvPEWAAAAAAD4Fa9epTwqKkqPPvqodu/erfT0dC1YsEC9evXSc889p/Pnz3vzrQAAAAAAaNdaXXBXVVWpuLhYTz/9tH70ox9pwIAB6tWrl9555x0ZhqGoqCjNnDlTqamp2rZtmzf6DAAAAABAuxfWmhf37NlThw8fliQZhqGuXbtq8ODBmjBhgjIyMpSRkaGrrrpKBw4c0Lx58/Rv//ZvWrVqle666y6vdB4AAAAAgPaqVQX3tddeq8mTJysjI0ODBw/WNddc47Zdr169tH79ek2bNk0LFy6k4AYAAAAABLxWFdybN2/2qP3QoUP1wgsvtOYtAQAAAADwC169aNqV3H777crPz2/LtwQAAAAAwCfatOCOjY1VTk5OW74lAAAAAAA+4VHBfe211+rFF1/U2bNnm/2a2tparV69WqmpqR53DgAAAAAAf+XR/3Dfddddmj17tmbMmKGsrCzdcsstGjRokHr27KmoqChJ0r/+9S8dPHhQ//d//6dt27bptddeU4cOHfTggw+asgAAAAAAALRHHhXcq1at0urVq7V//36tWbNGL7/88tczCrs4q/Pnz0u6eJuwAQMGOK9KbrPZvNhtAAAAAADaN48K7n/84x+qrq7WzJkzNXPmTHXp0kU/+clPdP78eZ04cUKSFB8fr/79++vGG29Uz549Tek0AAAAAADtnUcFd7du3bR7927n8+PHj6tPnz4aP3681zsGAAAAAI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S9nZ2Q3aTpw4UUuWLNHp06f1wQcfqLCwUOPHj5ckjR8/Xn/4wx+0Y8cOVVVV6fHHH28Q6gDgS+QdgGBB3gEIZH5VcEvSihUrdPToUcXHx2v27Nlav3694uLilJeX5/yGU5IWLVqkuLg4JSUlafTo0Xr22WfVr18/SRcvovH0008rKytLdrtdXbp00fz58321SADgFnkHIFiQdwAClkf/8Y1mOXPmjLFgwQLjzJkzvu6K32Ndeg/r0ntYl19jXXgP69J7WJfew7r8GuvCe1iX3sO69B6z1qXFMNzceAwAAAAAALSK351SDgAAAACAP6DgBgAAAADABBTcAAAAAACYgIIbAAAAAAATUHB7WWVlpUaOHKno6Gj169dP27dv93WX/FJtba3uuusudevWTTabTUOGDNG7777r6275vXfffVchISFasmSJr7vi137zm98oOTlZMTEx+ta3vqXTp0/7uks+Qd55B3lnDvLOO8i7i8g77yDvzEHeeYdZeRfmlbnAafr06UpMTFRlZaW2bdumsWPHqqysTHFxcb7uml85f/68evToobffflt2u12vvPKKRo0apUOHDslqtfq6e37pwoULmjVrlgYPHuzrrvi15557Tlu3btU777yj5ORk7d69Wx06dPB1t3yCvPMO8s77yDvvIO++Rt55B3nnfeSdd5iZd9wWzIscDofi4uJ04MAB2e12SdLQoUM1efJkTZ061ce9839dunTRa6+9puuuu87XXfFLzz//vD799FNVVVWpT58+mj9/vq+75Hfq6uqUnJyskpIS9e7d29fd8SnyzlzkXeuQd61H3n2NvDMXedc65F3rmZ13nFLuRWVlZbJarc4wlqT09HTt2bPHh70KDGVlZTp58qT69Onj6674pRMnTmjZsmVauHChr7vi144cOaKvvvpK+fn5uuaaa9SvXz+98MILvu6WT5B35iHvWoe88w7y7mvknXnIu9Yh77zD7LzjlHIvcjgcstlsLuNsNptOnDjhox4FhpqaGk2cOFHz5s1TbGysr7vjlx555BHNnDlTnTp18nVX/FpFRYWqqqq0d+9eHTp0SGVlZbr55pvVv39/ZWZm+rp7bYq8Mwd513rknXeQd18j78xB3rUeeecdZucdv3B7kdVqVXV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SFVVVc7xlZWVev311zVx4kQf9g4AAHiCghsAgHZm0qRJqq2tdfmFe/369Tp//jwFNwAAfoRTygEAaIeuv/56Wa1W/fnPf5Yk3XjjjZLE/28DAOBH+IUbAIB2aNKkSXrrrbd05MgR7d+/X++99x6/bgMA4Gf4hRsAgHboiy++UJcuXfT444+rpqZGS5Ys0dGjR5WQkODrrgEAgGai4AYAoJ3Kzs7WoUOHdObMGfXr10+bNm3ydZcAAIAHOKUcAIB2atKkSdq1a5f27t3L6eQAAPghfuEGAKCdOnv2rBITE3XhwgUdP35cHTt29HWXAACAB8J83QEAAOBeSEiIwsLCNGrUKIptAAD8EKeUAwDQTm3cuFGVlZWaNGmSr7sCAABagFPKAQBoZ95//33t2rVLixcvVkJCgnbu3OnrLgEAgBbgF24AANqZ//qv/9JPf/pTde7cWS+++KKvuwMAAFqIX7gBAAAAADABv3ADAAAAAGACCm4AAAAAAExAwQ0AAAAAgAkouAEAAAAAMAEFNwAAAAAAJqDgBgAAAADABBTcAAAAAACYgIIbAAAAAAATUHADAAAAAGCC/wcWJoeymLNODAAAAABJRU5ErkJggg==","text/plain":["<Figure size 1000x400 with 3 Axes>"]},"metadata":{},"output_type":"display_data"}],"source":["# 创建子图\n","fig, axs = plt.subplots(1, 3, figsize=(10, 4))\n","\n","# 绘制三个图,每个子图类似原图\n","three_pi = [\"previous ratio ($\\pi = 0.5$)\",\"Kasparov supporter ($\\pi = 0.8$)\",\"Deep Blue supporter ($\\pi = 0.2$)\"]\n","likelihoods = [likelihood1, likelihood2, likelihood3]\n","for i, ax in enumerate(axs):\n","    \n","    ax.scatter(y, likelihoods[i], c='black')\n","    \n","    for xx, yy in zip(y, likelihoods[i]):\n","        ax.plot([xx, xx], [yy, 0], 'gray', linestyle='-', linewidth=1, zorder=1)\n","    \n","    # 添加facet\n","    ax.set_title(three_pi[i])\n","\n","    ax.set_xlim(-0.2,6.2)\n","    ax.set_ylim(0,0.4)\n","\n","fig.supylabel('$f(y|\\pi)$')\n","fig.supxlabel('y')\n","plt.tight_layout()\n","plt.show()"]},{"cell_type":"markdown","id":"24170ea0","metadata":{},"source":["显然，对于Kasparov支持者来说， Kasparov获得六次胜利的概率远高于其他胜利次数。而对于深蓝支持者来说，Kasparov全败的可能性远高于其他胜利次数。\n","\n","换句话说，若 Kasparov 在 1977 的比赛中仅获取一场胜利，这种情况在低胜率下更可能出现，在高胜率下几乎不可能出现。\n","\n","那么Kasparov的胜率，更可能(likelihood)是深蓝支持者设想的那样($\\pi = 0.2$)。\n","\n","<center>\n","\n","![](https://www.bayesrulesbook.com/bookdown_files/figure-html/binom-chess-like-1.png)\n","\n","</center>\n","\n","- 在不同的支持者眼中(不同胜率$\\pi$下)，6场比赛只获胜1次的似然(likelihood)。  "]},{"cell_type":"markdown","id":"2c71c39a","metadata":{},"source":["**似然函数**  \n","\n","当Kasparov只获胜一场时，该事件在不同胜率下出现的可能性可以写为：\n","\n","$$\n","f(Y=1|\\pi=0.2) = \\binom{6}{1} 0.2^1 (1-0.2)^{5}\n","$$\n","$$\n","f(Y=1|\\pi=0.5) = \\binom{6}{1} 0.5^1 (1-0.5)^{5}\n","$$\n","$$\n","f(Y=1|\\pi=0.8) = \\binom{6}{1} 0.8^1 (1-0.8)^{5}\n","$$\n","\n","因此，获胜次数为1时的似然函数可以写成  \n","\n","$$  \n","L(\\pi|y=1) = f(y=1|\\pi) = \\binom{6}{1} \\pi^{1}(1-\\pi)^{6-1} = 6\\pi(1-\\pi)^{5}  \n","$$  \n","\n","不同胜率下的似然：  \n","\n","| $\\pi$\t        |0.2    |0.5    |0.8  \n","|---------------|-----  |----   |----|  \n","|$f(\\pi \\| y=1)$   |0.3932  |0.0938 |0.0015|  \n","\n","\n","\n","\n","**注意：**  \n","\n","似然函数表示的是，在各种可能的胜率$\\pi$下,获胜次数$Y=1$的可能性，所以  \n","\n","(1)该似然函数公式只取决于$\\pi$  \n","\n","(2)似然函数的总和加起来不为1（从条件概率的公式来看，似然函数的分母是不同的）"]},{"cell_type":"markdown","id":"72fa6eef","metadata":{},"source":["**Conditional PMF VS likelihood function**  \n","\n","当$\\pi$是已知的，条件概率质量密度函数$f(·|\\pi)$允许我们比较在$\\pi$发生的前提下，各种可能数据$Y$(e.g., $y_{1},y_{2}$)发生的概率。  \n","$$  \n","f(y_{1}|\\pi) \\; vs \\; f(y_{2}|\\pi)  \n","$$  \n","\n","当$Y = y$是已知的，似然函数$L(·|y)= f(y|·)$允许我们比较在各种不同的$\\pi$(e.g., $\\pi_{1},\\pi_{2}$)下，观察到数据$y$的相对可能性(relative likelihood)。  \n","\n","$$  \n","L(\\pi_{1}|y) \\; vs \\; L(\\pi_{2}|y)  \n","$$  \n","$$  \n","=  \n","f(y|\\pi_{1}) \\; vs \\; f(y|\\pi_{2})  \n","$$  \n"]},{"cell_type":"markdown","id":"f08ff408","metadata":{"id":"43F914CD67AC4306B066EFDEE8B1C3D2","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["**使用二项模型来描述获胜次数与胜率的关系**  \n","\n","在$n = 6$的比赛中，Kasparov的获胜次数与胜率的关系符合二项模型  \n","\n","$$  \n","Y|\\pi \\sim Bin(6,\\pi)  \n","$$  \n","\n","\n","$$  \n","f(y|\\pi) = \\binom{6}{y} \\pi^{y}(1-\\pi)^{6-y} \\quad\\quad for\\;y \\in \\{0,1,2,3,4,5,6\\}  \n","$$  \n","\n","-----------------------------------  \n","\n","**图例**  \n","\n","下图给出了几种 $f(y|\\pi)$，即在不同胜率$\\pi$下，不同获胜次数$Y$发生的可能性。  \n","\n","* 黑线表示在特定胜率下，Y=1(赢一次)的似然值  \n","\n","![Image Name](https://www.bayesrulesbook.com/bookdown_files/figure-html/binom-chess-1.png)"]},{"cell_type":"markdown","id":"ba16f7b5","metadata":{"id":"8D19F6E1800B449494BE04A42D75A323","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"subslide"},"tags":[]},"source":["这个概率质量密度函数总结了在特定胜率$\\pi$下观察到获胜次数$Y=y$的条件概率  \n","\n","例如，当Kasparov的胜率为0.8时，他赢下全部6场的可能性大约为0.26  \n","\n","$$  \n","f(y=0.6|\\pi=0.8) = \\binom{6}{6} 0.8^{6}(1-0.8)^{6-6} = 1\\times0.8^{6}\\times1 \\approx 0.26  \n","$$  \n","\n","而输掉全部6场比赛的可能性则接近为0  \n","\n","$$  \n","f(y=0|\\pi=0.8) = \\binom{6}{0} 0.8^{0}(1-0.8)^{6-0} = 1\\times0.2^{6}\\times1 \\approx 0.000064  \n","$$"]},{"cell_type":"markdown","id":"c1084d89","metadata":{},"source":["**计算分母**  \n","\n","在这个例子中，分母为$f(y=1)$，指在所有可能的胜率$\\pi$下，Kasparov获胜一场的总体概率(total probability)。总体概率则是观察到$Y=1$似然值的总和，可以写为：  \n","\n","$$  \n","f(y=1) = \\sum_{\\pi \\in\\{0.2,0.5,0.8\\}} L(\\pi|y=1)f(\\pi)  \n","$$  \n","\n","代入具体的值计算可得：  \n","\n","$$  \n","f(y = 1)  = L(\\pi = 0.2 | y=1) f(\\pi = 0.2) + L(\\pi = 0.5 | y=1) f(\\pi = 0.5) + L(\\pi = 0.8 | y=1) f(\\pi = 0.8) \\\\  \n"," \\approx 0.3932 \\cdot 0.10 + 0.0938 \\cdot 0.25 + 0.0015 \\cdot 0.65 \\\\  \n"," \\approx 0.0637  . \\\\  \n","$$  \n","\n","结果表明，考虑到所有可能的胜率$\\pi$，Kasparov只赢一场比赛的概率只有6%"]},{"cell_type":"markdown","metadata":{"id":"C678BEDDCFEE4D64BF3664637222CC73","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 先验概率模型(**Prior** probability model)"]},{"cell_type":"markdown","metadata":{"id":"B325B938D5DC493BA92FAA1260576E97","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"subslide"},"tags":[]},"source":["**建立先验模型**  \n","\n","另一个有趣的问题是，$\\pi$为随机变量，它的取值也存在一定的概率。\n","\n","- 换句话说，Kasparov支持者、深蓝支持者和中立者的数量是不一样的。\n","- 而当我们不确定三者具体人数时，我们可以通过设置先验的方式为不同支持者设定不同的数量，这代表了我们对每种支持者人数的**信念**。\n","\n","以下是一个我们随机设定的例子(先验)。\n","- 其中，每种种类的概率 $f(\\pi)$ 可随意设定。 例如，设定 $\\pi_{0.2} = 0.1$， 或者 $\\pi_{0.2} = 0.5$。 但需要所有$f(\\pi)$的总和为1。\n","\n","\n","| $\\pi$\t    |0.2  |0.5 |0.8 |Total  \n","|---------- |-----|----|----|-----|  \n","|$f(\\pi)$   |0.10  |0.25 |0.65   |1|  \n","\n"]},{"cell_type":"markdown","id":"a75304fb","metadata":{},"source":["此外，$\\pi$ 的数量也是可以变化的。\n","\n","- 例如，有一群宗教狂热者认为深蓝不可能战胜Kasparov，即 $\\pi = 0.01$。\n","- 那么新形成的先验分布可能如下。\n","\n"," \n","\n","| $\\pi$    |   0.01  | 0.2  | 0.5  | 0.79  | Total |\n","| -------- | --- | ---- | ---- | ---- | ----- |\n","| $f(\\pi)$ |  0.10   | 0.10 | 0.25 | 0.55 | 1     |\n","\n","\n"]},{"cell_type":"markdown","metadata":{"id":"60B89F33A68B4CF7975775F25F78A7ED","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 后验概率模型(Posterior probability model)"]},{"cell_type":"markdown","metadata":{"id":"6C080E1135CB494698A645033CEC0735","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"subslide"},"tags":[]},"source":["根据之前我们设定的先验模型，Kasparov战胜深蓝的可能性很高 ($\\pi_{0.8} = 0.65$)。  \n","\n","\n","\n","| $\\pi$\t    |0.2  |0.5 |0.8 |Total  \n","|---------- |-----|----|----|-----|  \n","|$f(\\pi)$   |0.10  |0.25 |0.65   |1|  \n","\n","\n","\n","然而，在97年的重逢对决中，Kasparov只获胜一次的这个数据告诉我们他的胜率很低。  \n","\n","综合先验和似然，我们可以得到后验模型，其中 Kasparov战胜深蓝的概率从$\\pi_{0.8}=0.65$降低为$\\pi_{0.8}=0.015$。意味着，他胜率为0.2的可能性是最大的 $\\pi_{0.2}=0.617$。  \n","\n","\n","![](https://www.bayesrulesbook.com/bookdown_files/figure-html/chesssummary-1.png)\n","- 左图为先验模型\n","- 中间的图为似然模型\n","- 右边的图为后验模型"]},{"cell_type":"markdown","metadata":{"id":"FA11E685F42343A99A3D978548B244BB","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"subslide"},"tags":[]},"source":["**后验模型的计算过程**  \n","\n","上图所表示的后验可写成：  \n","\n","$$  \n","f(\\pi|y=1)  \n","$$  \n","\n","表示当Kasparov只赢一场时，他胜率$\\pi$的概率分布 \n","\n","根据贝叶斯公式，我们可以进一步对后验概率公式进行展开：\n","\n","$$  \n","posterior = \\frac{ prior*likelihood} {normalizing\\;\\;constant}  \n","$$\n","\n","$$  \n","f(\\pi|y=1) = \\frac{ f(\\pi)L(\\pi|y=1)} {f(y=1)} \\quad\\quad for\\;\\pi \\in {0.2,0.5,0.8}  \n","$$  \n","\n","$$  \n","f(\\pi=0.2|y=1) = \\frac{0.10 \\times 0.3932} {0.0637} \\approx 0.617  \n","$$  \n","$$  \n","f(\\pi=0.5|y=1) = \\frac{0.25 \\times 0.0938} {0.0637} \\approx 0.368  \n","$$  \n","$$  \n","f(\\pi=0.8|y=1) = \\frac{0.65 \\times 0.0015} {0.0637} \\approx 0.015  \n","$$ "]},{"cell_type":"markdown","metadata":{"id":"4CB6688A68F94EEB95955D6284D93F48","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"subslide"},"tags":[]},"source":["下表对后验概率模型进行了总结，我们可知，经过了97年的重逢对决，Kasparov作为一个压制性棋手($\\pi$=0.8)的可能性已经从0.65降到了0.015  \n","\n","\n","| $\\pi$\t        |0.2    |0.5    |0.8 |Total  \n","|---------------|-----  |----   |----|-----|  \n","|$f(\\pi)$   |0.10  |0.25 |0.65|1|  \n","|$f(\\pi \\| y=1)$   |0.617  |0.368 |0.015|1|  \n"]},{"cell_type":"markdown","id":"d2b2b9aa","metadata":{"id":"18720F729ACE45E791924748FB0C6F6C","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["**补充材料**\n","\n","省略分母的计算\n","- 考虑到分母是一个常数，我们常常会胜率计算它\n","\n","省略分母后验的计算可写成：  \n","$$  \n","f(\\pi=0.2|y=1) = c⋅ 0.10⋅0.3932 \\propto 0.039320  \n","$$  \n","\n","$$  \n","f(\\pi=0.5|y=1) = c⋅ 0.25⋅0.0938 \\propto 0.023450  \n","$$  \n","$$  \n","f(\\pi=0.8|y=1) = c⋅ 0.65⋅0.0015 \\propto 0.000975  \n","$$  \n","\n","$\\propto$ 表示成比例，尽管这些未经标准化的后验概率总和不等于1  \n","$$  \n","0.039320 + 0.023450 + 0.000975 = 0.063745,  \n","$$  \n","但它们的比例关系并未改变(见下图)  \n","\n","![](https://www.bayesrulesbook.com/bookdown_files/figure-html/ch2scaled-1.png)  \n","\n"]},{"cell_type":"markdown","metadata":{"id":"32FE150214F9458ABA94A066A064D250","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"subslide"},"tags":[]},"source":["我们可以使用这些未经标准化的后验概率总和作为分母，来对后验概率进行标准化，会得到相同的计算结果。  \n","\n","$$  \n","f(\\pi = 0.2 | y = 1) = \\frac{0.039320}{0.039320 + 0.023450 + 0.000975} \\approx 0.617  \n","$$  \n","\n","注意，分母为所有似然值的总和，因此后验概率的计算公式还可以写成：  \n","\n","$$  \n","f(\\pi | y) = \\frac{f(\\pi)L(\\pi|y)}{f(y)} = \\frac{f(\\pi)L(\\pi|y)}{\\sum_{\\text{all } \\pi} f(\\pi)L(\\pi|y)} .  \n","$$"]},{"cell_type":"markdown","metadata":{"id":"94AC508E8A624683A2EC5EABF388630C","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["**Proportionality**  \n","\n","既然$f(y)$是一个用来标准化的常数，它并不受$\\pi$的影响，那么后验概率质量函数$f(\\pi|y)$ 就与$f(\\pi)$和$L(\\pi|y)$成正比  \n","\n","$$  \n","f(\\pi | y) = \\frac{f(\\pi)L(\\pi|y)}{f(y)} \\propto f(\\pi)L(\\pi|y)  \n","$$  \n","即，  \n","\n","$$  \n","posterior \\propto prior⋅ likelihood  \n","$$"]},{"cell_type":"markdown","metadata":{"id":"F23C7E8FF1114089AA5B85C0E556149D","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### Posterior simulation (with code)"]},{"cell_type":"markdown","metadata":{"id":"52EFA8F667444DE4ACF0A7EC03F634E6","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 1. 定义先验模型  \n","- 定义可能的胜率  \n","- 定义胜率的可能性"]},{"cell_type":"code","execution_count":15,"metadata":{"collapsed":false,"id":"64A9185EFA1F441AA7A5F19674B0D9B7","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[],"source":["import pandas as pd\n","import numpy as np\n","\n","# 定义可能的胜率\n","chess = pd.DataFrame({'pi':[0.2, 0.5, 0.8]})\n","\n","# 定义先验模型\n","prior = [0.10, 0.25, 0.65]\n"]},{"cell_type":"markdown","metadata":{"id":"328C9CDD383D428F95AB9F50E9CF2378","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 2. 模拟在特定胜率下，6场比赛中的获胜次数  \n","- 重复这个过程10000次"]},{"cell_type":"code","execution_count":16,"metadata":{"collapsed":false,"id":"DCEB0F5834C84488900317269533239B","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[{"data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>pi</th>\n","      <th>y</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>1</th>\n","      <td>0.5</td>\n","      <td>1</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0.8</td>\n","      <td>5</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0.8</td>\n","      <td>4</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0.8</td>\n","      <td>4</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0.8</td>\n","      <td>4</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0.8</td>\n","      <td>3</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0.8</td>\n","      <td>5</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0.8</td>\n","      <td>5</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0.8</td>\n","      <td>4</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0.8</td>\n","      <td>6</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["    pi  y\n","1  0.5  1\n","2  0.8  5\n","2  0.8  4\n","2  0.8  4\n","2  0.8  4\n","2  0.8  3\n","2  0.8  5\n","2  0.8  5\n","2  0.8  4\n","2  0.8  6"]},"execution_count":16,"metadata":{},"output_type":"execute_result"}],"source":["# 设置随机数种子保证可重复性\n","np.random.seed(84735)\n","\n","# 从先验中抽取10000个 pi 值，并生成对应的y值\n","\n","chess_sim = chess.sample(n=10000, weights=prior, replace=True)\n","\n","chess_sim['y'] = np.random.binomial(n=6, p=chess_sim['pi'], size=len(chess_sim))\n","\n","chess_sim.head(10)"]},{"cell_type":"code","execution_count":17,"metadata":{"collapsed":false,"id":"B01F19B2ECD94D819F66DBDA3DD5A8B7","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":["    pi     n  percentage\n","2  0.2  1037      0.1037\n","1  0.5  2495      0.2495\n","0  0.8  6468      0.6468\n"]}],"source":["#对pi的抽取情况进行总结\n","chess_counts =  chess_sim['pi'].value_counts().reset_index()\n","\n","chess_counts.columns = ['pi','n']\n","\n","chess_counts['percentage'] = (chess_counts['n']/len(chess_sim))\n","\n","chess_counts = chess_counts.sort_values(by='pi')\n","\n","print(chess_counts)\n"]},{"cell_type":"markdown","metadata":{"id":"D3DBBEAC730946EAAD722C4924196105","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 3.  不同胜率下，不同获胜次数的分布情况$f(y|\\pi)$"]},{"cell_type":"code","execution_count":13,"metadata":{"collapsed":false,"id":"E609B3A0D2F6442DB6EEC22DDCC08630","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[],"source":["# 导入绘图工具 seaborn\n","import seaborn as sns\n","chess_lik = sns.FacetGrid(chess_sim,col=\"pi\")\n","chess_lik.map(sns.histplot,'y',stat='probability',discrete=True)"]},{"cell_type":"markdown","metadata":{"id":"2D0E488270DB424780C78EB445FB6968","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["### 4. 查看$y=1$时，对应的$\\pi$的分布情况"]},{"cell_type":"code","execution_count":14,"metadata":{"collapsed":false,"id":"DE41B327894F44AAA5FE50169E8F30C1","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[],"source":["chess_post = chess_sim[chess_sim['y'] == 1].value_counts()\n","chess_post"]},{"cell_type":"code","execution_count":15,"metadata":{"collapsed":false,"id":"0197BF2D947C488993CF1A6A0332E14D","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"outputs":[{"data":{"image/png":"iVBORw0KGgoAAAANSUhEUgAAAjsAAAGwCAYAAABPSaTdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAp/klEQVR4nO3df1BV953/8Re/EfVeRMO9sIIak6hEUVeN3vxaqwT8UTeZsLMxMep2rW4cMEa61t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"metadata":{},"output_type":"display_data"}],"source":["chess_post = chess_sim[chess_sim['y'] == 1]\n","\n","chess_post_plot = sns.histplot(data = chess_post, x=\"pi\")\n","\n","#plt.xticks(np.arange(0.2,0.8,0.3))\n","\n","chess_post_plot.set(xticks=[0.2,0.5,0.8])\n","sns.despine()"]},{"cell_type":"markdown","metadata":{"id":"5F6C74DBE55A409B8C5A405C096C6063","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":true,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["## Part 4: 频率学派与贝叶斯学派的对比"]},{"cell_type":"markdown","metadata":{"id":"F03D26AA3F6D4264804D082F64AD127F","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["### 频率学派如何看待这个世界？  \n"]},{"cell_type":"markdown","metadata":{"id":"F52FF9E3BB0D4426BE12744419D75B36","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["在对比频率学派与贝叶斯学派的差异之前，让我们首先回顾一下频率学派是如何看待这个世界的。"]},{"cell_type":"markdown","metadata":{"id":"DF4176B1AB244B1FBFE7B56EE7C4CEF0","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["\n","![Image Name](https://cdn.kesci.com/upload/image/rhqcgapoeq.png?imageView2/0/w/960/h/960)  \n"]},{"cell_type":"markdown","metadata":{"id":"A9714D8E42E94470B99F24B8019A1D67","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["我们假设存在两个城市，其中A城市的平均工资为$6000$元每月，B城市的平均工资为$6500$元每月。  \n","\n","然后，由于两个城市的人口太多，通过两个城市中所有人的工资去计算平均工作是*费时费力的*。其次，对于‘地球中大陆的占比’的问题，记录所有的陆地和海洋是不太可能的。  \n","\n","因此，统计学家选择 **抽样** 的方式通过 **样本** 来估计两个城市 **总体** 的均值。"]},{"cell_type":"markdown","metadata":{"id":"69D2D035A7184E838F516CAB14810FE6","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":true,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["值得注意的是：  \n","\n","1. 这个例子中两个总体均值的差异(工资差异)是**固定的**，即世界的真相是固定的。然而在真实的“大世界”中，比如人们幸福感上的差异，差异的“真相”是我们想要探索的，未知的。  \n","\n","2. 通过抽样的方式去估计总体会存在**噪音**或者*偏差*。  \n","\n","3. 频率学派认为**概率**是噪音的体现。结合前两点，两个城市的差异是固定的，而抽样带来了误差，因此概率代表的是样本能代表总体的概率。  \n","\n","4. 噪音受到抽样**样本大小**和工资方差**变异**的影响。另一个常见的问题是抽样样本的概率分布与样本大小和总体方差有关，如下图。"]},{"cell_type":"markdown","metadata":{"id":"27C279DA1B914CC583C9A4B1AC688CF0","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["\n","![Image Name](https://cdn.kesci.com/upload/image/rhqcnfd9gl.png?imageView2/0/w/480/h/480)  \n"]},{"cell_type":"markdown","metadata":{"id":"7D779EDEEAEE4E7AAA0F5F88E002D011","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["最后，频率学派如何**推断**出两个总体之间的差异？  \n","- 由于两个总体间的差异是固定的，因此，判断差异是否显著与噪声大小有关，即信噪比。  \n","- 频率学派通过零假设的显著性检验(Null hypothesis significant test, NHST)来判断这个显著性。即通过拒绝极端值的方式避免噪音的影响。在数学上通过计算置信区间(confidence interval)和$p$值来帮助推断过程。"]},{"cell_type":"markdown","metadata":{"id":"9002548EDAAD4D49921B9AFFFF2ACD26","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["### 贝叶斯学派如何看待这个世界？"]},{"cell_type":"markdown","metadata":{"id":"502124AF926E4E80AD29451A675A0E27","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["贝叶斯学派的出现与兴趣在于频率学派所存在的问题。  \n","主要体现在2个方面：  \n","1. 世界的真相(差异)可能不是固定的。比如对于复杂世界现象背后的机制是难以确定的。  \n","2. 通过抽样样本去替代总体容易出现偏差。比如由于抽到极端值从而错误的估计总体。此外，相关的问题还有type Ⅰ错误，统计检验力，*p*-hacking等。"]},{"cell_type":"markdown","metadata":{"id":"9FAA8B4E5A77478B945A06CEE0DC3555","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["贝叶斯学派提供了另一种角度去解释上述的问题。  \n","\n","- 首先，贝叶斯学派认为世界的真相不是固定不变的，并且他们通过概率去描述这种变化。比如，两个城市平均工资的差异可能受到各种因素的影响，因此这个差异不是固定的。而两个城市平均工资的差异或可能性，比如这个差异为$500$的概率为$80$%，代表了个体对这个差异的信念**(belief)**，比如有$80$%的把握相信这个差异为$500$。  \n","\n","- 其次，贝叶斯学派并不是通过NHST来推测这个差异。而是通过贝叶斯公式。需要注意的是，虽然贝叶斯学派认为世界的真相并不是固定的，但总世界中所观测的现象(抽样样本得到的数据)是固定的。因此，对于世界真相的信念可以根据数据进行更新。"]},{"cell_type":"markdown","metadata":{"id":"73A3B69D752145B9A72D966FFBD5131A","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["#### Thomas Bayes  \n","![Image Name](https://pic2.zhimg.com/v2-ae48785e2b67af851e236b3d38c78c8d_r.jpg)  \n"]},{"cell_type":"markdown","metadata":{"id":"F1A2BC5646E4404894385A59748F1C72","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":true,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["#### Pierre Simon Laplace  \n","\n","![Image Name](https://th.bing.com/th/id/R.c252b05834293b10a3005882940d6622?rik=Kr8G5HIK%2fObbHw&riu=http%3a%2f%2fimages.fineartamerica.com%2fimages-medium-large%2fpierre-simon-marquis-de-laplace-maria-platt-evans.jpg&ehk=uHIIZ0qdCLmD0FXAHR4lUGfySQGNKlhNkJgoWIOMJG4%3d&risl=&pid=ImgRaw&r=0)  \n"]},{"cell_type":"markdown","metadata":{"id":"D3AE1964F0BC4D6BB8023F776079DD27","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["### 两个学派的差异对比  \n","\n","\n","|                     | 频率学派   | 贝叶斯学派   |  \n","| ------------------- | ---------- | ------------ |  \n","| 世界真相 (参数) | 固定       | 变化         |  \n","| 概率                | 抽样的噪音 | 信念         |  \n","| 推断过程            | NHST       | 贝叶斯定理   |  \n","| 数据                | 存在噪音   | 固定         |  \n","| 推断可更新性        | 否         | 是           |  \n","| 主观性              | 前提预设   | 通过先验设定 |"]},{"cell_type":"markdown","metadata":{"id":"BAE20732DF0D42B78C8EAA15122ABDDC","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["### 贝叶斯的主观性  \n","\n","**任何统计分析方法都不可能完全客观，因此主观性是一个相对概念:**  \n","\n","* 贝叶斯学派的主观性通过先验的设定来体现，透明，不易让人产生误解  \n","\n","* 频率学派的主观性暗含在各种**前提预设**中，比如方差分析中的方差齐性和正态性，这种看似‘客观的’预设，一方面难以满足，一方面也是一种主观的设定。  \n","\n","* 更为宏观的来说，样本的抽取，数据清理方式的选择，分析方法的选择，$p$值的设定，这些都存在主观性。因此，频率学派并没有想象的那么‘客观’。  \n","\n","* 主观不一定是坏事：通过量化方法将个体的经验和专家知识整合到数据分析之中。  \n","\n"]},{"cell_type":"markdown","metadata":{"id":"C30A91AA641C41EF9F0372AD2986B148","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["#### 重复抽样的不同作用"]},{"cell_type":"markdown","metadata":{"id":"BB7588F54F1741EDA6E80FBB1CB37BB2","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["##### 频率学派  \n","* 统计推断依赖于参数的**抽样分布**，即只要无限(long-run)的进行抽样，样本分布的参数就会有某种分布形式；  \n","* NHST中的$p$值和置信区间的解读均依赖于“无限次抽样”的预设；  \n","* 实际操作中，我们往往只会收集一次数据，并不会反复的进行抽样；有些情境中，预设“无限次重复抽样并不合理；  \n","\n","##### 贝叶斯学派  \n","* 假定参数本身是分布，不确定性一起存在于推断之中；  \n","* 直接根据数据对先验信念进行更新；  \n","\n","**置信区间(confidence interval) vs 可信区间(credible interval)**  \n","\n","**No free lunch: 各有优势和缺陷**"]},{"cell_type":"markdown","metadata":{"id":"E04271253C4342AC965A3FF317EB596E","jupyter":{},"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[]},"source":["#### 不同的先验和似然会产生不同的后验分布  \n","\n","![Image Name](https://cdn.kesci.com/upload/image/rhqcb9gji7.png?imageView2/0/w/500/h/500)  \n"]},{"cell_type":"markdown","metadata":{"id":"7363A9184283478190008FAD019A20BF","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["#### NHST的\"弱项\""]},{"cell_type":"markdown","metadata":{"id":"16DE7849334F42118F4D98681C98DFD1","jupyter":{},"mdEditEnable":false,"notebookId":"65002ba1048d25fc8d9ec3f4","runtime":{"execution_status":null,"status":"default"},"scrolled":false,"slideshow":{"slide_type":"slide"},"tags":[],"trusted":true},"source":["* 无法直接对零假设(null hypothesis)进行支持，即如果两个总体没有显著差异，他们的相似程度有多少？  (许岳培等, 2023, *应用心理学*)  \n","\n","* 一次性只能对比两个总体的假设进行比较；  \n","\n","* 控制假阳性是一个棘手的问题"]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.11.3"}},"nbformat":4,"nbformat_minor":5}
